<!doctype html>
<html lang="zh-CH">
<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<!-- <meta name="viewport" content="width=device-width, initial-scale=1"> -->
	<title>木投网--个人中心--我的订单</title>
	<link rel="stylesheet" href="/resource/css/mt_index.css">
	<link rel="stylesheet" href="/resource/css/mt_user.css">
	<link rel="stylesheet" href="/resource/css/mt_showBo.css">
</head>
<body>
@include("common.shop_user_head")
		<div class="user-cont left">
			<div class="user-title">我的订单</div>
			<div class="order">
				<!-- 我的订单 -->
				<div class="order-title">
					<ul class="ul-title">
						<li class="active"><a href="/user_order?status=0">全部订单</a></li>
						<li><a href="/user_order?status=1">待付款 <span> </span></a></li>
						<li><a href="/user_order?status=3">待收货 <span> </span></a></li>
					</ul>
				</div>
				<div class="table">
					<table>
						<thead>
							<tr>
								<th>订单商品</th>
								<th>支付总金额</th>
								<th>订单状态</th>
								<th>操作</th>
							</tr>
						</thead>
						@foreach($data as $data1)

						<tbody>
							<tr class="sep-row">
								<td colspan="4"></td>
							</tr>
							<tr class="tr-th">
								<td colspan="4">
									<span class="time">下单时间：<i>{{date('Y-m-d',$data1->order_time)}}</i></span>
									<span class="number">
										订单编号：
										<a href="javascript:;">{{$data1->order_sn}}</a>
									</span>
								</td>
							</tr>
							<tr>
								<td class="shop-in">
									<a href="javascript:;" target="blank">
										<img src="{{$data1->product_img}}"  alt="">
									</a>
									<a href="javascript:;"  target="blank" >{{$data1->product_name}}</a>
								</td>
								<td>
									<div class="amount">
										{{$data1->amount}}
										<span>
											@if($data1->payment_id == 0)
											<span>京东在线支付</span>
												@else
												<span>POS机货到付款</span>
												@endif
										</span>
									</div>
								</td>
								<td>
									@if($data1->order_status == 1)
									等待支付
									@elseif($data1->order_status == 2)
									已支付
									@elseif($data1->order_status == 4)
									已支付
									@elseif($data1->order_status == 5)
									已完成
									@elseif($data1->order_status == 6)
									已取消
									@endif
								</td>
								<td class="last">
									@if($data1->payment_id == 0 && $data1->order_status==1)
									<a href="javascript:;" class="btn- btn-pay">立即付款</a>
									@endif
									@if( $data1->order_status==5 || $data1->order_status == 6)
											<a href="javascript:;" class="delete-order"  rel="{{$data1->order_id}}"> 删除订单</a>
									@endif
									@if( $data1->order_status==2 || $data1->order_status == 4)
											<a href="javascript:;" class="btn- btn-confirm" rel="{{$data1->order_id}}">确认收货</a>
									@endif
									<a href="/order_details?order_id={{$data1->order_id}}" class="look-details">查看详情</a>
									@if($data1->order_status==1)
									<a href="javascript:;" class="remove-order" rel="{{$data1->order_id}}">取消订单</a>
									@endif
								</td>
							</tr>
						</tbody>
						@endforeach
					</table>
				</div>
				<div class="table">
					<table>
						<thead>
							<tr>
								<th>订单商品</th>
								<th>支付总金额</th>
								<th>订单状态</th>
								<th>操作</th>
							</tr>
						</thead>
						<tbody class="wait">
							<tr class="sep-row">
								<td colspan="4"></td>
							</tr>
							@foreach($data as $data1)
							<tr class="tr-th">
								<td colspan="4">
									<span class="time">下单时间：<i>{{date('Y-m-d',$data1->order_time)}}</i></span>
									<span class="number">
										订单编号：
										<a href="javascript:;">{{$data1->order_sn}}</a>
									</span>
								</td>
							</tr>
							<tr>
								<td class="shop-in">
									<a href="javascript:;" target="blank">
										<img src="{{$data1->product_img}}" alt="">
									</a>
									<a href="javascript:;">{{$data1->product_name}}</a>
								</td>
								<td>
									<div class="amount">
										{{$data1->amount}}
										<span>
											@if($data1->payment_id == 0)
												<span>京东在线支付</span>
											@else
												<span>POS机货到付款</span>
											@endif
									</div>
								</td>
								<td>等待支付</td>
								<td class="last">
									<a href="javascript:;" class="btn- btn-pay">立即付款</a>
									<a href="/order_details" class="look-details">查看详情</a>
									<a href="javascript:;" class="remove-order" rel="{{$data1->order_id}}">取消订单</a>


								</td>
							</tr>
								@endforeach
						</tbody>
					</table>
				</div>
				<div class="table">
					<table>
						<thead>
							<tr>
								<th>订单商品</th>
								<th>支付总金额</th>
								<th>订单状态</th>
								<th>操作</th>
							</tr>
						</thead>
						<tbody class="wait">
							<tr class="sep-row">
								<td colspan="4"></td>
							</tr>
							@foreach($data as $data1)
							<tr class="tr-th">
								<td colspan="4">
									<span class="time">下单时间：<i>{{date('Y-m-d',$data1->order_time)}}</span>
									<span class="number">
										订单编号：
										<a href="javascript:;" >{{$data1->order_sn}}</a>
									</span>
								</td>
							</tr>
							<tr>
								<td class="shop-in">
									<a href="javascript:;" target="blank">
										<img src="{{$data1->product_img}}" alt="">
									</a>
									<a href="javascript:;" target="blank">{{$data1->product_name}}</a>
								</td>
								<td>
									<div class="amount">
										{{$data1->amount}}
										<span>
											@if($data1->payment_id == 0)
												<span>京东在线支付</span>
											@else
												<span>POS机货到付款</span>
										@endif
									</div>
								</td>
								<td>已支付</td>
								<td class="last">
									@if( $data1->order_status == 2 || $data1->order_status == 4)
									<a href="javascript:;" class="btn- btn-confirm"  rel="{{$data1->order_id}}">确认收货</a>
									@endif
									<a href="/order_details" class="look-details" >查看详情</a>
								</td>
							</tr>
								@endforeach
						</tbody>
					</table>
				</div>
			</div>
		</div>
		@include("common.shop_user_foot")
<script src="/resource/js/jquery-1.11.3.min.js"></script>
<script src="/resource/js/mt_index.js"></script>
<script src="/resource/js/mt_showBo.js"></script>  <!-- 提示信息 -->
<script>
	//点击删除
	$('a.delete-order').click(function(){
		var order_id = $(this).attr('rel');
		Showbo.Msg.confirm('<img class="left" src="/resource/img/user_if.png" alt=""><span style="float:left;font-size:22px;color:#221815;text-align:left;line-height:34px;">您确定要删除订单吗？<br/><i class="font-size:14px;color:#898989;">删除后，将永久删除</i></span>',function(btn){
			if (btn == 'yes') {
				$.ajax({

					url : '/del_order_pc',
					type : "POST",
					data : {order_id:order_id},
					dataType : "json",
					cache:"false",
					timeout:30000,
					success : function(json) {
						if(json.code == 1){
							location=location
						}else{

						}
					}
				});
			}else{
				return false;
			};
		});
		$('#dvMsgBox input.btn+input.btn').css('margin-right','-31px');
	});
	//点击取消
	$('a.remove-order').click(function(){
		var order_id = $(this).attr('rel');
		Showbo.Msg.confirm('<img class="left" src="/resource/img/user_if.png" alt=""><span style="float:left;font-size:22px;color:#221815;text-align:left;line-height:34px;">确定取消订单？<br/><i class="font-size:14px;color:#898989;">订单取消后，将不能恢复，您确定取消吗？</i></span>',function(btn){
			if (btn == 'yes') {
				$.ajax({
					url : '/cancel_order_pc',
					type : "POST",
					data : {order_id:order_id},
					dataType : "json",
					cache:"false",
					timeout:30000,
					success : function(json) {
						if(json.code == 1){
							location=location
						}else{

						}
					}
				});

			}else{
				return false;
			};
		});
		$('#dvMsgBox input.btn+input.btn').css('margin-right','11px');
	});
	//确认收货
	$('a.btn-confirm').click(function(){
		var order_id = $(this).attr('rel');
		Showbo.Msg.confirm('<img class="left" src="/resource/img/user_if.png" alt=""><span style="float:left;font-size:22px;color:#221815;text-align:left;line-height:60px;">是否确认收货？</span>',function(btn){
			if (btn == 'yes') {
				$.ajax({

					url : '/confirm_receipt',
					type : "POST",
					data : {order_id:order_id},
					dataType : "json",
					cache:"false",
					timeout:30000,
					success : function(json) {
						if(json.code == 1){
							location=location
						}else{

						}
					}
				});
			}else{
				return false;
			};
		});
		$('#dvMsgBox input.btn+input.btn').css('margin-right','-100px');
	});
	$.ajax({
		url : '/user_order_num',
		type : "POST",
		data : {status:1},
		dataType : "json",
		cache:"false",
		timeout:30000,
		success : function(json) {

			if(json.code >= 0){
			//	console.log(json.code);
				$('.ul-title li').eq(1).find('span').html(json.code);
			}
		}
	});
	$.ajax({
		url : '/user_order_num',
		type : "POST",
		data : {status:3},
		dataType : "json",
		cache:"false",
		timeout:30000,
		success : function(json) {
			if(json.code >= 0){
			//	console.log(json.code);
				$('.ul-title li').eq(2).find('span').html(json.code);
			}
		}
	});

</script>
</body>
</html>